<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/5/22 17:27
 */

namespace App\Transformers;

use Illuminate\Contracts\Support\Arrayable;
use League\Fractal\TransformerAbstract;

/**
 * Class AuthorTransformer
 * @package App\Transformers
 */
class NoTransformer extends TransformerAbstract
{
    public function transform($array)
    {
        if (is_array($array))
            return $array;

        if ($array instanceof Arrayable) {
            return $array->toArray();
        }

        return [];
    }
}